package com.cyx;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author 陈裕星
 * @version 1.0
 */
public class 双向排序 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();//数据规模
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = i + 1;
        }

        int m = sc.nextInt();//操作次数
        for (int i = 0; i < m; i++) {
            int controller = sc.nextInt();
            int wz = sc.nextInt();

            //判断输入的操作
            if(controller == 0) {
                Arrays.sort(arr,0,wz);
                //反转
                for (int j = 0,k = wz-1; j <= k; j++,k--) {
                    int temp;
                    temp = arr[k];
                    arr[k] = arr[j];
                    arr[j] = temp;
                }
            }else{
                Arrays.sort(arr,wz-1,n);
            }
        }
        for (int i = 0; i < n; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
